package com.hsylient.javase.chapter11.demo05;

/**
 * 打断当前线程，但是会出现异常
 */
public class SleepTest {

    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }, "t1");
        t1.start();

        Thread.sleep(1000);
        t1.interrupt();
    }

}
